ng911ok.lib.config_dataclasses module#

Provides some of the classes and logic for handling configuration data.

class ConfigDumper(stream, default_style=None, default_flow_style=False, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None, sort_keys=True)#

Bases: Dumper

YAML dumper that can generate config.yml.

classmethod anchor_scalar(value: str | int | float | bool | None, alias: str)#

Registers a scalar value that should be assigned an anchor named alias in the output YAML.

generate_anchor(node)#
represent_data(data)#
serialize_node(node, parent, index)#
anchored_scalars: ClassVar[dict[str | int | float | bool | None, str]] = {}#

Registry for scalar values that should be assigned specifically-named anchors. The keys are the scalars and the values are the anchor names.

property serialized_scalar_values: list[str | int | float | bool | None]#

Returns a list of all scalar values that have been serialized (so far) by an instance.

yaml_representers = {<class 'NoneType'>: <function SafeRepresenter.represent_none>, <class 'bool'>: <function SafeRepresenter.represent_bool>, <class 'builtin_function_or_method'>: <function Representer.represent_name>, <class 'bytes'>: <function SafeRepresenter.represent_binary>, <class 'collections.OrderedDict'>: <function Representer.represent_ordered_dict>, <class 'complex'>: <function Representer.represent_complex>, <class 'datetime.date'>: <function SafeRepresenter.represent_date>, <class 'datetime.datetime'>: <function SafeRepresenter.represent_datetime>, <class 'dict'>: <function SafeRepresenter.represent_dict>, <class 'float'>: <function SafeRepresenter.represent_float>, <class 'function'>: <function Representer.represent_name>, <class 'int'>: <function SafeRepresenter.represent_int>, <class 'list'>: <function SafeRepresenter.represent_list>, <class 'module'>: <function Representer.represent_module>, <class 'ng911ok.lib.config_dataclasses.NG911Domain'>: <bound method YAMLObject.to_yaml of <class 'ng911ok.lib.config_dataclasses.NG911Domain'>>, <class 'ng911ok.lib.config_dataclasses.NG911Domain'>: <bound method YAMLObject.to_yaml of <class 'ng911ok.lib.config_dataclasses.NG911Domain'>>, <class 'ng911ok.lib.config_dataclasses.NG911Field'>: <bound method YAMLObject.to_yaml of <class 'ng911ok.lib.config_dataclasses.NG911Field'>>, <class 'ng911ok.lib.config_dataclasses.NG911Field'>: <bound method YAMLObject.to_yaml of <class 'ng911ok.lib.config_dataclasses.NG911Field'>>, <class 'ng911ok.lib.config_dataclasses.NG911GeodatabaseInfo'>: <bound method YAMLObject.to_yaml of <class 'ng911ok.lib.config_dataclasses.NG911GeodatabaseInfo'>>, <class 'ng911ok.lib.config_dataclasses.NG911GeodatabaseInfo'>: <bound method YAMLObject.to_yaml of <class 'ng911ok.lib.config_dataclasses.NG911GeodatabaseInfo'>>, <class 'set'>: <function SafeRepresenter.represent_set>, <class 'str'>: <function SafeRepresenter.represent_str>, <class 'tuple'>: <function Representer.represent_tuple>, None: <function SafeRepresenter.represent_undefined>}#
class NG911Domain(name: str, description: str, type: Literal['CODED', 'RANGE'], entries)#

Bases: YAMLObject

yaml_dumper#

alias of ConfigDumper

yaml_loader#

alias of SafeLoader

classmethod from_yaml(loader: SafeLoader, node: Node)#

Convert a representation node to a Python object.

property as_namespace: IterableNamespace[str | dict[str, str]]#
description: str#
entries: FrozenDict[str, str]#
name: str#
type: Literal['CODED', 'RANGE']#
yaml_tag = '!Domain'#
class NG911FeatureClass(role: str, name: str, geometry_type: Literal['POINT', 'POLYLINE', 'POLYGON'], dataset: str, unique_id: NG911Field, fields: T_FieldNamespace)#

Bases: Generic[T_FieldNamespace]

property as_namespace: IterableNamespace[str | list[str]]#
dataset: str#
property field_value_table_rows: list[list[str | int | Literal['SHORT', 'LONG', 'BIGINTEGER', 'FLOAT', 'DOUBLE', 'TEXT', 'DATE', 'DATEHIGHPRECISION', 'DATEONLY', 'TIMEONLY', 'TIMESTAMPOFFSET', 'BLOB', 'GUID', 'RASTER'] | None]]#

Returns a list of lists suitable for passing to arcpy.management.AddFields as the argument for field_description.

..seealso:

:attr:`NG911Field.value_table_row`
fields: T_FieldNamespace#
geometry_type: Literal['POINT', 'POLYLINE', 'POLYGON']#
name: str#
role: str#
unique_id: NG911Field#
class NG911Field(role: str, name: str, type: Literal['Geometry', 'SmallInteger', 'Integer', 'BigInteger', 'Single', 'Double', 'String', 'Date', 'DateOnly', 'TimeOnly', 'TimestampOffset', 'Guid', 'Raster'], priority: Literal['M', 'C', 'O', 'T'], length: int | None = None, domain: NG911Domain | None = None, fill_value: str | int | float | None = None)#

Bases: YAMLObject

yaml_dumper#

alias of ConfigDumper

yaml_loader#

alias of SafeLoader

classmethod from_yaml(loader: SafeLoader, node: Node)#

Convert a representation node to a Python object.

property arcpy_field: Field#
property as_namespace: IterableNamespace[str | int | IterableNamespace[str | dict[str, str]] | None]#
domain: NG911Domain | None#
fill_value: str | int | float | None#
length: int | None#
name: str#
priority: Literal['M', 'C', 'O', 'T']#
role: str#
type: Literal['Geometry', 'SmallInteger', 'Integer', 'BigInteger', 'Single', 'Double', 'String', 'Date', 'DateOnly', 'TimeOnly', 'TimestampOffset', 'Guid', 'Raster']#
property type_keyword: Literal['SHORT', 'LONG', 'BIGINTEGER', 'FLOAT', 'DOUBLE', 'TEXT', 'DATE', 'DATEHIGHPRECISION', 'DATEONLY', 'TIMEONLY', 'TIMESTAMPOFFSET', 'BLOB', 'GUID', 'RASTER']#

Returns the keyword used in field creation based on the field’s type attribute.

See also

FIELD_TYPE_KEYWORDS

property value_table_row: list[str | int | Literal['SHORT', 'LONG', 'BIGINTEGER', 'FLOAT', 'DOUBLE', 'TEXT', 'DATE', 'DATEHIGHPRECISION', 'DATEONLY', 'TIMEONLY', 'TIMESTAMPOFFSET', 'BLOB', 'GUID', 'RASTER'] | None]#

Returns a list representing the field’s specifications, ordered as [<name>, <type>, <alias>, <length>, <default_value>, <domain>]. Intended for use as an element of a list of lists passed to arcpy.management.AddFields.

yaml_tag = '!Field'#
class NG911GeodatabaseInfo(spatial_reference_factory_code_2d: int, spatial_reference_factory_code_3d: int, required_dataset_name: str, optional_dataset_name: str)#

Bases: YAMLObject

yaml_dumper#

alias of ConfigDumper

yaml_loader#

alias of SafeLoader

optional_dataset_name: str#
required_dataset_name: str#
spatial_reference_factory_code_2d: int#
spatial_reference_factory_code_3d: int#
yaml_tag = '!GDBInfo'#
class WDManager(directory: str | None = None)#

Bases: AbstractContextManager[None]

Context manager that temporarily changes the working directory.

_abc_impl = <_abc._abc_data object>#
original_directory: str#
target_directory: str | None#
class YAMLIterableNamespaceMeta(name, bases, namespace, /, **kwargs)#

Bases: ABCMeta, YAMLObjectMetaclass

Empty class that serves to prevent a metaclass conflict in _NG911Config.